package com.ebs.md.fxmonitor.marketmonitor.esper;

/**
 * Revision Author:
 *  $File: //depot/MarketData/fxmonitor/main/src/main/java/com/ebs/md/fxmonitor/marketmonitor/esper/PriceTopBasicFactStatement.java $
 *  $Revision: #1 $
 *  $DateTime: 2012/09/27 15:07:34 $
 *  $Change: 115260 $
 *  $Author: Aviad.Yosef $
 */

import com.ebs.md.container.esper.AbsStatement;
import com.ebs.md.fxmonitor.marketmonitor.config.IPriceToppingConfig;


public class PriceTopBasicFactStatement
extends AbsStatement<IPriceToppingConfig>
{
	protected final static String esper_time_period = "10 seconds";
	
	@Override
	protected String createEplExpression() {
		String str =
		String.format(eplExpressionText
				, config.getName()  //1. configuration name.
				, esper_time_period //2. OBCNew   .win:ext_timed(timestamp, %d seconds) as nPrev
				, esper_time_period //3. OBCNew   .win:ext_timed(timestamp, %d seconds) as n
				, esper_time_period //4. OBCRemove.win:ext_timed(timestamp, %d seconds) as rPrev 
				, esper_time_period //5. OBCRemove.win:ext_timed(timestamp, %d seconds) as r 

				//6. region
				, getRegion()          

				//7. pipsDiffFromBest.
				, config.getDistanceThreshold()            
				
				//8. cancel time. time the quote remain in the market after someone else took his place at tob. 
				, config.getCancelTimeThreshold()          
				
				//9. submit time. time at tob.
				, config.getSubmitTimeThreshold()          
				);
		return str;
	}
	
}
